import fetchTool from '@/tools/fetchTool'
import apis from './apis'

interface GetParams {
  key1: string
  key2: number
}
interface ExampleGetRes {
  name: string
  code: number
  nick: string
}
export function exampleGet(params: GetParams) {
  return fetchTool
    .fetch<ExampleGetRes>({
      url: apis.exampleApi1,
      method: 'get',
      params,
    })
    .then((data) => {
      console.log(data.data.nick)
    })
}
interface PostData {
  key1: string
  key2: number
}
export async function examplePost(data: PostData) {
  const res = await fetchTool.fetch({
    url: apis.exampleApi1,
    method: 'post',
    data,
  })

  return res
}
